﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pong_Project
{
    class Players
    {
        // A static list of all the players in the game
        private static List<Player> players = new List<Player>();

        // This method adds players to the list
        public static void Add(Player player)
        {
            players.Add(player);
        }

        // Returns the Player with the specified identity, or null if it's not found
        public static Player Get(PlayerIdentity identity)
        {
            foreach (Player p in players)
            {
                if (p.Identity == identity)
                    return p;
            }
            return null;
        }
    }
}
